package cn.ainit.fx.tbook;


import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.Types;

import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import cn.ainit.sys.common.dao.BusinessBaseDao;
import cn.ainit.sys.menu.SessionCont;

@Transactional
@Repository
public class TBookDaoImpl extends BusinessBaseDao implements TBookDao {

	@Override
	public String createTBookInfo(String djId,String dsId,String stationId,HttpSession session) throws Exception {
		Connection conn= null;
		CallableStatement cs =null;
		String msg="";
		try {
			 conn= this.getJdbcTemplate().getDataSource().getConnection();
			 String callName = "{Call PK_FX_ZT.up_fxztToSp(?,?,?,?,?)}";
			 cs = conn.prepareCall(callName);
			 cs.setString(1,djId);
			 cs.setString(2,dsId);
			 cs.setString(3, (String)session.getAttribute(SessionCont.uid));
			 cs.setString(4,stationId);
			 cs.registerOutParameter(5,Types.VARCHAR);
			 cs.execute();
			 msg=cs.getString(5);
		} catch (Exception e) {
			e.printStackTrace();
		}finally{
			if(cs!=null){
				cs.close();
			}
			if(conn!=null){
				conn.close();
			}
		}
		return msg;
	}
	
	
	
}
